Tutorials
 / ASP.NET Web Forms
 / Use and handling of the Selection Area
 
                                 
                                
                                    Use and handling of the Selection Area
                                 
                                
                                    
                                        In This Topic
                                    
                                
                                
 Overview 
This tutorial shows how to work with selection area (also known as Region of Interest, or ROI) in a sample ASP.NET Web Forms application that will apply a negative filter on a particular area.
DocuVieware™ requires .NET Framework 4.6 or above. 
The screenshots have been taken using Visual Studio 2015 and GdPicture.NET™ 14, it may differ from the current release. 
Summary
The starting point of this tutorial is the application you have at the end of Your first DocuVieware ASP.NET Web Forms page, it is a prerequisite so if you do not have it, please follow this tutorial first.
You are going to add three buttons above the DocuVieware™ control, one will simply output the coordinates of the selection area (if any), another one will clear it and finally the last button will apply a negative filter on the selected area.
 
 Display the ROI coordinates 
This is done client side very easily, add a button that will call a JavaScript function on click. Here is the code:
 
 Clear the ROI 
It is often usefull to have a button to clear the ROI (i.e. reset the selection area) and it is done the exact same way: a button calling a JavaScript function on click event.
 
 Apply the negative filter on the ROI 
Now you are going to use a CustomAction to apply the Negative filter on the selected area. You need to send the ROI coordinates server side, set a ROI on the actual image and apply the filter on it.
 Server side 
Now, you need to handle the custom action server side. This has already been demonstrated in the Going further with DocuVieware - Custom actions tutorial so do not hesitate to go back if needed.
You are going to need a class to retrieve the parameters (i.e. the ROI coordinates). To keep it simple, you can proceed like this:  
Because you need to handle a custom action that is triggered client side, you need to handle it in the Global.asax.cs file, in Application_Load and the dispatcher (please refer to Client-Server coming and going with Custom Actions if you need more information about this).
Then you can implement the custom action handler itself in the Default.aspx.cs file.
To retrieve the image object, set the ROI on it based on the coordinates we received from the client and apply the filter on it, here is the corresponding source code:
  
            
            See Also